/**
 * @(#)RabbitMQTopicConsumer.java, 2018/12/17
 * <p/>
 * Copyright 2018 Netease, Inc. All rights reserved.
 * NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.chengzhi.mq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Consumer;

/**
 * @author 阮承志(wb.ruanchengzhi @ mesg.corp.netease.com)
 **/
public class RabbitMQTopicConsumerTwo {
    public static void main(String[] args) throws Exception {
        String queueName = "topic-queue2";
        Connection connection = RabbitMQConstants.getConnection();
        Channel channel = connection.createChannel();
        RabbitMQConstants.createExchangeAndQueue(channel, true, queueName);
        channel.queueBind(queueName, "topic-exchange", "topicKey.*");
        channel.basicQos(1);
        channel.basicConsume(queueName, true, RabbitMQConstants.getconsumer(channel));
    }
}
